package com.jgsu.farm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@NoArgsConstructor
@AllArgsConstructor
@Data
@Table(name = "question")
public class Question implements Serializable {
    /**
     * strategy = GenerationType.IDENTITY
     * 主键由数据库生成, 采用数据库自增长, Oracle不支持这种方式,
     * 配置后可获取mysql自增的id
     * */

    @Id
    @GeneratedValue(generator = "JDBC",strategy = GenerationType.IDENTITY)
    @NonNull
    private Integer questid;
    @NonNull
    private Integer userid;

    private String title;

    private String content;

    private Integer image;

    private String domain;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date time;

}